<?php
/**
 * Created by PhpStorm.
 * User: edmmss
 * Date: 2019/1/15
 * Time: 09:21
 */

namespace app\modules\strategy;


class Context
{
    private $_comparator;

    public function __construct(ComparatorInterface $comparator)
    {
        $this->_comparator = $comparator;
    }

    public function executeStrategy(array $elements): array
    {
        uasort($elements, [$this->_comparator, 'compare']);

        return $elements;
    }
}